import React from 'react';
import {Link} from "react-router-dom";
import {Button} from "antd";
import GUtils from "@/utils";
import {ExclamationCircleOutlined} from "@ant-design/icons";

const Config = (Action) => {

    const columns = [
        {title:"订单编号",dataIndex:"orderNo",width:210, render(v,vo){
            return <div>
                <div>单号： <Link to={`detail/view?id=${vo.uid}`}>{v}</Link></div>
                <div>下单时间：{GUtils.dateTimeFormatter(vo.createTime)}
                    {
                        vo.notes &&  <a className="ml-8"><ExclamationCircleOutlined style={{color:"#FFA500"}} title={vo.notes}/></a>
                    }

                </div>
            </div>
            }},
        {title:"产品信息",dataIndex:"产品信息",width:200, render(v, vo) {

              return  <div>
                    <div>产品名称： <Link to={`${window.CONFIG.PAGE_RECHARGE_PRODUCT}/detail/view?id=${vo.productId}`}>{vo.productName}</Link></div>
                    <div>金额规格：{GUtils.renderAmount(vo.balanceAmount)}元</div>
                    <div>售价：{GUtils.renderAmount(vo.payAmount)}元</div>
                </div>
            }},
        {title:"用户信息",dataIndex:"userId",width:160,render(v,vo){
              return  <div>
                    <div>用户昵称： {vo.userNickname}</div>
                    <div>用户ID：{vo.userId}</div>
                    <div>手机：{vo.userPhone}</div>
                </div>
            }},
        {title:"订单金额",dataIndex:"balanceAmount",width:70, render:GUtils.renderAmount},
        {title:"订单状态",dataIndex:"status",width:70, render:GUtils.renderRechargeOrderStatus},


        {title: '操作',dataIndex: 'id',width: 70,render(id,vo){
                return <div>
                    <Link to={`detail/view?id=${vo.uid}`} className="mr-8">查看详情</Link>
                </div>
            }},
    ];
    return {
        ...window.CONFIG.getPagerConfig(Action), columns
    };
};


export default Config;
